<?php
namespace app\admin\model;
use think\Model;
use think\Db;
use think\Cache;
class Rule extends Model{

	//添加权限方法
	public function addRule($data){
		
		// dump($data);die;
		$map['module_name'] = $data['module_name'];
		$map['controller_name'] = $data['controller_name'];
		$map['action_name'] = $data['action_name'];
		$info = Db::name('rule')
		->where($map)
		->find();
		// dump($info);die;
		
		if($info){
			return false;
		}
		
		return Db::name('rule')->insert($data);
	}

	
	public function editRule($id){
		
		$data = Db::name('rule')->where('id',$id)->find();
		// dump($data);die;
		
		
		return $data;
	}

}